/******************************************************************************
* 文件名称: msg_port.c
* 内容摘要: 底层接口
* 创建者の: 孔佳伟
* 个人主页: https://gitee.com/thin-wind/jump
* 修改记录: 
******************************************************************************/

#include "msg_port.h"
#include "msg_log.h"
#include <stdio.h>


int ll_read(const Msg_S *msg)
{
    if(NULL == msg)
        return -1;
    if(0 != PutToRxBuf(msg))
    {
        MSG_LOG("Msg rxbuf full\n");
        return -1;    
    }
    
    return 0;
}


#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
extern int clientSockfd;
uint8_t txbuf[1024] = {0};
int ll_write(const Msg_S *msg)
{
    txbuf[0] = (msg->id >> 8) & 0xFF;
    txbuf[1] = (msg->id >> 0) & 0xFF;
    memcpy(&txbuf[2], msg->data, 8);
    send(clientSockfd, txbuf, 10, 0);
    return 0;
}


